﻿using FirstFloor.ModernUI.Windows.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using FirstFloor.ModernUI.Presentation;
using BYS.XiAnComDept.App.Pages;
using BYS.XiAnComDept.BussLogic;

namespace BYS.XiAnComDept.App
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : ModernWindow
    {
        public static MainWindow Current;

        public MainWindow() : base()
        {
            Current = this;
            InitializeComponent();
            this.Loaded += MainWindow_Loaded;
            using (BllFactory factory = new BllFactory())
            {
                AppSetting appSetting = factory.Db.AppSettings.SingleOrDefault(x => x.Id == 1);
                if (appSetting != null)
                {
                    AppearanceManager.Current.ThemeSource = new Uri(appSetting.ThemeUri, UriKind.RelativeOrAbsolute);
                    AppearanceManager.Current.AccentColor = (Color)ColorConverter.ConvertFromString(appSetting.ThemeColor);
                    AppearanceManager.Current.FontSize = (FontSize)Enum.Parse(typeof(FontSize), appSetting.FontSize);
                }
            }
        }

        public void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            
        }
    }
}
